How to get LinkSets of current module

Dear all,

I'm a new in DXL, I was supposed to get the Traget Module of Linksets in the current module...
any ideas ? :)

Thanks in advance.
Ola.3y3y - Mon Dec 20 06:04:09 EST 2010

Re: How to get LinkSets of current module
PDU - Mon Dec 20 08:22:41 EST 2010

Hi,

look at example in DXL Help :

Object o = current 
Link lnk 
ModName_ targetMod 
for lnk in o->"*" do {
    targetMod = target lnk
    read(fullName(targetMod), true)
}

 


Pierre

 

Re: How to get LinkSets of current module
Ola.3y3y - Tue Dec 21 03:43:02 EST 2010

PDU - Mon Dec 20 08:22:41 EST 2010

Hi,

look at example in DXL Help :

Object o = current 
Link lnk 
ModName_ targetMod 
for lnk in o->"*" do {
    targetMod = target lnk
    read(fullName(targetMod), true)
}

 


Pierre

 

Hello Pierre,

Thanks for your reply, but actually if you opened module properties (in File -> Module Properties...), you will find tab named Linksets, and finally Target Module.
Target Module is what I'm trying to get.

(e.g /TCM/20 System/...)

can you help me with that ?

Re: How to get LinkSets of current module
SystemAdmin - Tue Dec 21 08:53:10 EST 2010

Ola.3y3y - Tue Dec 21 03:43:02 EST 2010
Hello Pierre,

Thanks for your reply, but actually if you opened module properties (in File -> Module Properties...), you will find tab named Linksets, and finally Target Module.
Target Module is what I'm trying to get.

(e.g /TCM/20 System/...)

can you help me with that ?

Look in the DXL manual for 'LinkModuleDescriptor'

This is what you are looking for.

Remember that these 'Linkset Pairing', as DOORS call them, are saved in the parent FOLDER of the current module. To manipulate those LinkModuleDescriptor, you must loop within a folder.

Maybe this code can help you a little:

Project p = current
Item itemref
LinkModuleDescriptor linkmoddesc
String s
 
    for itemref in p do
        {                      
                if(type(itemref)!= "Folder") then continue
                
                for linkmoddesc in folder itemref do
                {             
                        s=  getTargetName(linkModDesc)
                        //store s in skip list...
 
                }// end of link module descriptor in folder loop
        
        } // end of folder in project loop

Re: How to get LinkSets of current module
llandale - Wed Dec 22 01:01:33 EST 2010

ATessier reply is pretty good, but I'll enhance it. (On holiday, got no DXL reference to look at.,..)

First off, while the tab may say 'linkset', those are not in fact linksets, then are in fact linkset pairings AKA Link Module Descriptors LMDs in DXL. Its just a piece of information (such as a parking spot number) tell which linksets to use when the links are created, and if created.

So for a particular module, you would get its full name then its parent folder, then as ATessier shows browse all the LMDs stored in that folder. In this case you would get the source name of the LMD and if it isn't your module then skip it.

I think the following commands will help and I think I got the syntax right:

string NameSourceFull = fullName(current Module)
Folder fldCurrent = getParentFolder(current Module)
string NameSourceLMD = getSourceName(LMD)

There is other info about LMDs you might as well report, such as Mandatory or Overrideable or neither. If you are clever you will check to make sure the target of the LMD is a valid module. Understand that LMDs can and do get corrupted and useless easily but not removed, such as if you rename a module.

  • Louie

Re: How to get LinkSets of current module
Ola_3y3y - Wed Dec 22 08:48:35 EST 2010

SystemAdmin - Tue Dec 21 08:53:10 EST 2010

Look in the DXL manual for 'LinkModuleDescriptor'

This is what you are looking for.

Remember that these 'Linkset Pairing', as DOORS call them, are saved in the parent FOLDER of the current module. To manipulate those LinkModuleDescriptor, you must loop within a folder.

Maybe this code can help you a little:

Project p = current
Item itemref
LinkModuleDescriptor linkmoddesc
String s
 
    for itemref in p do
        {                      
                if(type(itemref)!= "Folder") then continue
                
                for linkmoddesc in folder itemref do
                {             
                        s=  getTargetName(linkModDesc)
                        //store s in skip list...
 
                }// end of link module descriptor in folder loop
        
        } // end of folder in project loop

Hello ATessier,

Thanks about your reply it really helped me :)

Re: How to get LinkSets of current module
Ola_3y3y - Wed Dec 22 08:49:55 EST 2010

llandale - Wed Dec 22 01:01:33 EST 2010
ATessier reply is pretty good, but I'll enhance it. (On holiday, got no DXL reference to look at.,..)

First off, while the tab may say 'linkset', those are not in fact linksets, then are in fact linkset pairings AKA Link Module Descriptors LMDs in DXL. Its just a piece of information (such as a parking spot number) tell which linksets to use when the links are created, and if created.

So for a particular module, you would get its full name then its parent folder, then as ATessier shows browse all the LMDs stored in that folder. In this case you would get the source name of the LMD and if it isn't your module then skip it.

I think the following commands will help and I think I got the syntax right:

string NameSourceFull = fullName(current Module)
Folder fldCurrent = getParentFolder(current Module)
string NameSourceLMD = getSourceName(LMD)

There is other info about LMDs you might as well report, such as Mandatory or Overrideable or neither. If you are clever you will check to make sure the target of the LMD is a valid module. Understand that LMDs can and do get corrupted and useless easily but not removed, such as if you rename a module.

  • Louie

Hello llandale,

Thanks for your reply too :)... you really helped me, hope you enjoy your holiday :)

Re: How to get LinkSets of current module
Jonny Tim - Thu Jan 17 11:36:47 EST 2019

Ola_3y3y - Wed Dec 22 08:49:55 EST 2010
Hello llandale,

Thanks for your reply too :)... you really helped me, hope you enjoy your holiday :)

Hi, everyone

I want to get linkset too but this linkset is not only from 2 Modules in same Folder or Project, this linkset is from database. Is there a way to get this linkset?


 

Re: How to get LinkSets of current module
Jonny Tim - Mon Jan 21 01:57:48 EST 2019

Jonny Tim - Thu Jan 17 11:36:47 EST 2019

Hi, everyone

I want to get linkset too but this linkset is not only from 2 Modules in same Folder or Project, this linkset is from database. Is there a way to get this linkset?


 

Please....

Re: How to get LinkSets of current module
Mike.Scharnow - Mon Jan 21 03:22:47 EST 2019

Jonny Tim - Mon Jan 21 01:57:48 EST 2019

Please....

Hi Jonny,

it is not clear what you mean by "linkset from database".

In DOORS you have:

  • Link Modules. These
    • have a name that signifies the meaning of the link
    • are a container for link sets
  • Link Sets: These
    • always connect two modules a and b
    • There must be a link set for a->b, before you can create a link from a to b
    • a and b can be identical, so, in this case you have a link set called  a->a
    • technically, link sets are the objects of link modules
  • Link Restrictions, in DXL they are called LinkModuleDescriptors. These
    • tell you the preferred link set when you want to create a link from a to b
    • might be set to mandatory, so that whenever you create a link from a to b, you MUST use the link module denoted in the link restriction

A link set can contain any two modules in the database. There is nothing like a link module that only works for two modules or only inside a folder or one project. If you have any restriction that a link module shall only connect modules from one folder, this is only a convention.

So, every link module is "for a complete database" and every link set connects two modules who may be or not be inside the same folder

Re: How to get LinkSets of current module
Jonny Tim - Mon Jan 21 03:51:24 EST 2019

Mike.Scharnow - Mon Jan 21 03:22:47 EST 2019

Hi Jonny,

it is not clear what you mean by "linkset from database".

In DOORS you have:

  • Link Modules. These
    • have a name that signifies the meaning of the link
    • are a container for link sets
  • Link Sets: These
    • always connect two modules a and b
    • There must be a link set for a->b, before you can create a link from a to b
    • a and b can be identical, so, in this case you have a link set called  a->a
    • technically, link sets are the objects of link modules
  • Link Restrictions, in DXL they are called LinkModuleDescriptors. These
    • tell you the preferred link set when you want to create a link from a to b
    • might be set to mandatory, so that whenever you create a link from a to b, you MUST use the link module denoted in the link restriction

A link set can contain any two modules in the database. There is nothing like a link module that only works for two modules or only inside a folder or one project. If you have any restriction that a link module shall only connect modules from one folder, this is only a convention.

So, every link module is "for a complete database" and every link set connects two modules who may be or not be inside the same folder

Hi Mike,

Thanks for your help but I have found the way to find linkset. My question is, for given source and target module,  how to get linkset when I run my script in source module. And maybe someone need this so I post here

string str_link_mod 
Module m = current 
string str_target = //string target module
str_link_mod = getDefaultLinkModule(module(name(m)), module(str_target))

Hope it helps.

Re: How to get LinkSets of current module
Mike.Scharnow - Mon Jan 21 06:23:20 EST 2019

Jonny Tim - Mon Jan 21 03:51:24 EST 2019

Hi Mike,

Thanks for your help but I have found the way to find linkset. My question is, for given source and target module,  how to get linkset when I run my script in source module. And maybe someone need this so I post here

string str_link_mod 
Module m = current 
string str_target = //string target module
str_link_mod = getDefaultLinkModule(module(name(m)), module(str_target))

Hope it helps.

you should distinguish link set and link module. getDefaultLinkModule will not give you a link set.

What do you really need, what do you want to do with the link set / link module?

And getDefaultLinkModule will only gives you the default module. If the link restriction is not mandatory, you might have deviations, but I'm not sure if this is of interest for your use case.

 

Re: How to get LinkSets of current module
Jonny Tim - Wed Jan 30 04:31:48 EST 2019

Mike.Scharnow - Mon Jan 21 06:23:20 EST 2019

you should distinguish link set and link module. getDefaultLinkModule will not give you a link set.

What do you really need, what do you want to do with the link set / link module?

And getDefaultLinkModule will only gives you the default module. If the link restriction is not mandatory, you might have deviations, but I'm not sure if this is of interest for your use case.

 

Hi Mike,

It worked for me but I really don't understand why. What is the meaning of getDefaultLinkModule? In the document it is written, "Returns the name of the default link module.". But between 2 Module there can have only one Linkset....

 

Re: How to get LinkSets of current module
Mike.Scharnow - Wed Jan 30 06:13:28 EST 2019

Jonny Tim - Wed Jan 30 04:31:48 EST 2019

Hi Mike,

It worked for me but I really don't understand why. What is the meaning of getDefaultLinkModule? In the document it is written, "Returns the name of the default link module.". But between 2 Module there can have only one Linkset....

 

I found the following page https://www.ibm.com/support/knowledgecenter/de/SSYQBZ_9.6.1/com.ibm.doors.requirements.doc/topics/c_linksetpairings.html that explains the theory about link modules and sets etc.

Perhaps they explain it better than I do.

 

What you need to remember is: No link is done without purpose, every link describes a concrete relationship between two objects. The purpose can be seen in the name of the link module.

For example you have a lower level module and a higher level module. Now, in the higher level module there are a) high level design decisions and b) high level requirements. In the lower level module there is a) implementation information and b) low level requirements. In this scenario you might have two link modules 1) "implements" and 2) "specifies".  Both can be used to create links from objects of the lower level to objects of the higher level module. 

This means when a user creates a link from lower to higher module, he has to specify which link module shall be used.In this case it is better if there is no default link module between lower and higher module. 

In other scenarios most of the links from low to high are "implements" links and only a small number of links have other reasons. In this case you would have a default link module which is not mandatory. In yet other scenarios, only one type of link is allowed from lower to higher. It all depends on your requirements data model.

 

And again: yes, for any combination source module -> link module -> destination module there is only one link set, but in the combination source module -> link module #2 -> destination module there is also a link set

 

hope that clarifies the situation

Mike